- 
                Notifications
    You must be signed in to change notification settings 
- Fork 82
WIP: [objective_c] Migrate to native assets #2329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            liamappelbe
  wants to merge
  27
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
objc_native
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Draft
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | PR HealthChangelog Entry ❗
 Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with  
License Headers  | 
| Files | 
|---|
| pkgs/objective_c/example/lib/main.dart | 
| pkgs/objective_c/lib/src/ns_input_stream.dart | 
All source files should start with a license header.
Unrelated files missing license headers
| Files | 
|---|
| pkgs/jni/lib/src/third_party/generated_bindings.dart | 
| pkgs/native_doc_dartifier/lib/native_doc_dartifier.dart | 
| pkgs/native_doc_dartifier/lib/src/native_doc_dartifier_base.dart | 
This check can be disabled by tagging the PR with skip-license-check.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    package:ffigen
  
    package:objective_c
  
    package:swiftgen
  
    type-infra
  A repository infrastructure change or enhancement 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Notes
@Nativeannotations to load all the ffi symbols. Previously this worked because I loaded the dylib into the executable first, then relied on the@Nativefallback behavior to load the symbols from the exe. Now I'm explicitly setting the asset name to the built dylib, which appears to disable that fallback behavior. But all the core ObjC runtime symbols (egobjc_msgSend) are linked into the exe, not the dylib. So I had to split the C bindings into a set that loads from the dylib, and a set that loads from the exe. There are now 3 sets of ffigen created bindings: the objective C bindings (loads from the dylib), the bindings for my C code (loads from the dylib), and the bindings for the built in ObjC runtime's C code (loads from the exe).Pointer<ObjCObject>, so I had to manually wrap them inNSStrings in globals.dart. I tried splitting the ObjC bindings like I split the C bindings, but this caused all sorts of other problems.